package com.im.entity;

import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;

/**
 * 用户实体
 * @author xainsir
 * @since 2025-02-14
 */
@Data
@Schema(description = "用户实体")
@TableName("im_user")
public class ImUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "雪花ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "用户ID 11位永不重复id")
    @TableField("user_id")
    private Integer userId;

    @Schema(description = "用户名，唯一")
    @TableField("username")
    private String username;

    @Schema(description = "加密存储的密码")
    @TableField("password")
    private String password;

    @Schema(description = "用户昵称")
    @TableField("nickname")
    private String nickname;

    @Schema(description = "头像URL")
    @TableField("avatar")
    private String avatar;

    @Schema(description = "邮箱，唯一")
    @TableField("email")
    private String email;

    @Schema(description = "手机号，唯一")
    @TableField("phone")
    private String phone;

    @Schema(description = "用户状态(1:正常, 0:封禁)")
    @TableField("status")
    private Integer status;

    @Schema(description = "最后登录IP")
    @TableField("last_login_ip")
    private String lastLoginIp;

    @Schema(description = "用户注册时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime; // 自动填充

    @Schema(description = "用户信息更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime; // 自动填充
}
